<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>众秀众筹</title>
	<meta name="Keywords" content="36氪，天使客，智金汇，大家投，投行圈，投壶网，汇梦公社，投哪儿，第五创
天使街，咱们众筹，众筹客，投筹网，合盈众筹，蚂蚁天使，云投汇，禾胜金服，恒星计划，京东金融，聚募，投筹网
众投邦，云筹，天使汇，人人投，筹道股权，360淘金，蚂蚁达客，资本汇，京北众筹，微投网，原始会，百度百众，AngelList
创投圈，牛投网，多彩投，头狼，星筹，红岭创投，云岸金服，云创股，苏宁众筹，星揽投，影视宝" />
	<meta name="Description" content="汇集各行业高手分析众筹项目，行业问答，众筹资讯。" />
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
	<meta name="renderer" content="webkit"/>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cropper.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />

	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>
	<script src="<%=path%>/css/bootstrap/3.3.5/js/bootstrap.min.js"></script>

	<script src="<%=path%>/js/slider.js"></script>
	<script src="<%=path%>/js/cropper.min.js"></script>
	<script src="<%=path%>/js/common.js"></script>
	<script type="text/javascript" src="<%=path %>/js/plugins/ajaxfileupload.js"></script>
	
	<script type="text/javascript" src="<%=path %>/js/plugins/CityJson.js"></script>
    <script type="text/javascript" src="<%=path %>/js/plugins/ProJson.js" ></script>
    <script type="text/javascript">
        $(function () {
        	var city_value="${navigate.platformCity}";
        	var province_value="${navigate.platformProvince}";
            $.each(province, function (k, p) { 
                var option = "<option value='" + p.ProID + "' id='" + p.ProName + "'>" + p.ProName + "</option>";
                $("#selProvince").append(option);
            });
             
            $("#selProvince").change(function () {
            	provinceChange();
            });
            
            $("#selCity").change(function () {
            	$("#platform_city").val($(this).find("option:selected").text());
            });
            
            var platformType='${navigate.platformType}';
            if(platformType=='1'){
            	$("#platformType_1").attr("checked",true);
            	selectType(1);
            }else if(platformType=='2'){
            	$("#platformType_2").attr("checked",true);
            	selectType(2);
            }else if(platformType=='3'){
            	$("#platformType_3").attr("checked",true);
            	selectType(3);
            }
                        
            $("#selProvince option[id='"+province_value+"']").attr("selected",true);
            provinceChange();
            $("#selCity option[id='"+city_value+"']").attr("selected",true);
            $("#platform_city").val($("#selCity").find("option:selected").text());
        });
        
        function provinceChange(){
        	var selValue = $("#selProvince").val();
            $("#selCity option:gt(0)").remove();
            $("#platform_city").val("");
            
            $.each(city, function (k, p) { 
                if (p.ProID == selValue) {
                    var option = "<option value='" + p.CityID + "' id='" + p.CityName + "'>" + p.CityName + "</option>";
                    $("#selCity").append(option);
                }
            });
            
            $("#platform_province").val($("#selProvince").find("option:selected").text());
        }
        
        function selectType(platform_type){
        	if(platform_type==1){
        		$("#platform_address_div").show();
        	}else if(platform_type==2){
        		$("#platform_address_div").show();
        	}else if(platform_type==3){
        		$("#platform_address_div").show();
        	}
        }
    </script>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="container page-single">
	<div class="col-md-12">
		<div class="panel panel-default">
			<div class="panel-heading">
				<h3 class="panel-title">平台编辑</h3>
			</div>
			<div class="panel-body event-create">

				<form class="form-horizontal" id="navigate_form" action="javascript:insertNavigate()">
					<input type="hidden" name="navigateId" value="${navigate.navigateId}">
					<div class="form-group">
						<label for="aa" class="col-sm-1 control-label">上传logo <em>*</em></label>
						<div class="col-sm-10">
							<div class="img-container">
								<img id="platform_Logo_img" src="<%=path %>/uncheck/pictures/servlet?id=${navigate.platformLogo}" width="240" height="160" alt="Picture">
							</div>
							<label class="btn btn-primary" for="platform_Logo_file" title="上传图片">
								<input type="file" class="hide" id="platform_Logo_file" name="file" accept="image/*" 
								onchange="javascript:uploadImage('platform_Logo_img','platform_Logo_file','platform_Logo',2)">上传图片
							</label>
							<input type="hidden" id="platform_Logo" name="platformLogo" value="${navigate.platformLogo}">
						</div>
					</div>
					
					<div class="form-group">
						<label for="inputEmail3" class="col-sm-1 control-label">
							平台名称 <em>*</em>
						</label>
						<div class="col-sm-10">
							<input class="form-control event-create-form-control-block" maxlength="100" minlength="1" 
							name="platformName" placeholder="平台名称" type="text" value="${navigate.platformName}">
						</div>
					</div>
					<div class="form-group">
						<label for="inputEmail3" class="col-sm-1 control-label">
							平台网址 <em>*</em>
						</label>
						<div class="col-sm-10">
							<input class="form-control event-create-form-control-block" maxlength="100" minlength="1" 
							name="platformUrl" placeholder="平台网址" type="text" value="${navigate.platformUrl}">
						</div>
					</div>
					<div class="form-group">
						<label for="inputEmail3" class="col-sm-1 control-label">
								平台类型 <em>*</em>
						</label>
						<div class="col-sm-10">
							<label class='checkbox-inline'>
								<input type="radio" name="platformType" id="platformType_1" value="1" onclick="javascript:selectType(1)">
								股权
							</label>
							<label class='checkbox-inline'>
								<input type="radio" name="platformType" id="platformType_2" value="2" onclick="javascript:selectType(2)">
								店铺
							</label>
							<label class='checkbox-inline'>
								<input type="radio" name="platformType" id="platformType_3" value="3" onclick="javascript:selectType(3)">
								影视
							</label>
						</div>
					</div>
					
					<div class="form-group" id="platform_address_div">
						<label for="inputEmail3" class="col-sm-1 control-label">
							项目地点
						</label>
						<div class="col-sm-2">
							<select id="selProvince">
						        <option value="">--请选择省份--</option>
						    </select>
						    <input type="hidden" id="platform_province" name="platformProvince" value="${navigate.platformProvince}">
						</div>
						<div class="col-sm-2">
							<select id="selCity">
						        <option value="">--请选择城市--</option>
						    </select>
						    <input type="hidden" id="platform_city" name="platformCity" value="${navigate.platformCity}">
						</div>
					</div>
					
					<div class="form-group">
						<label for="inputEmail3" class="col-sm-1 control-label">
							网站使用体验 <em>*</em>
						</label>
						<div class="col-sm-5">
							<input class="form-control event-create-form-control-block" maxlength="100" minlength="1" 
							name="platformExperience" placeholder="网站使用体验" type="text" value="${navigate.platformExperience}">
						</div>
						<label for="inputEmail3" class="col-sm-1 control-label">
							成立时间 <em>*</em>
						</label>
						<div class="col-sm-5" id="data_setup_time">
							<div id="datepicker" class="input-daterange input-group">
								<input type="text"  name="setupTime"  value="<fmt:formatDate value='${navigate.setupTime}' pattern='yyyy-MM-dd'/>" class="input-sm form-control">
							</div>
						</div>
					</div>
					
					<div class="form-group">
						
						<label for="inputEmail3" class="col-sm-1 control-label">
							项目信息披露 <em>*</em>
						</label>
						<div class="col-sm-5">
							<input class="form-control event-create-form-control-block" maxlength="100" minlength="1" 
							name="projectDisclosure" placeholder="项目信息披露" type="text" value="${navigate.projectDisclosure}">
						</div>
						
						<label for="inputEmail3" class="col-sm-1 control-label">
							项目风险提示 <em>*</em>
						</label>
						<div class="col-sm-5">
							<input class="form-control event-create-form-control-block" maxlength="100" minlength="1" 
							name="projectRiskPrompt" placeholder="项目风险提示" type="text" value="${navigate.projectRiskPrompt}">
						</div>
					</div>
					
					<div class="form-group">
						<div class="col-sm-offset-1 col-sm-10">
							<button type="submit" class="btn btn-primary">提交平台导航</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<jsp:include page="/views/commons/footer.jsp"></jsp:include>
<script type="text/javascript">
	$(function() {
		$("#data_setup_time .input-daterange").datepicker({
			keyboardNavigation: !1,
			forceParse: !1,
			autoclose: !0
		})
	})
	function insertNavigate(){
		$("#navigate_confirm_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
		$.ajax({
			url : path + "/admin/navigate/update",
			type : "post",
			dataType : "json",
			data : $("#navigate_form").serialize(),
			success : function(data)
			{
				if(data.result){
					layer.msg("发布成功",{icon: 1});
					window.location.href=path + "/views/navigate/navigate_list.jsp";
				}else{
					layer.msg(data.message,{icon: 2});
					$("#navigate_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
				}
			},error:function(){
				layer.msg("服务器网络繁忙",{icon: 2});
				$("#navigate_confirm_btn").removeClass("disabled").removeAttr("disabled").val("提交");
			}
		});
	}
	</script>
</body>
</html>